﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="UrlCN.aspx.cs" Inherits="WAD.WEB.Client.Page.UrlCN" %>
<!doctype html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="viewport" content="width=device-width,height=device-height,inital-scale=1.0,maximum-scale=1.0,user-scalable=no;">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <meta name="format-detection" content="telephone=no">
     <link href="../css/css.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div class="ifm-body iframe-body" style="width:100%">
</div>
<script src="../js/jquery-2.1.4.min.js" type="text/javascript"></script>
<script src="../js/base.js" type="text/javascript"></script>
<script src="../js/ajax-data.js" type="text/javascript"></script>
<script src="../js/dialog.js" type="text/javascript"></script>
<script src="../js/detail_url.js" type="text/javascript"></script>
<script>
    //url.cn 短域名处理
    function load(url) {
        wait.show();
        $.post("/Client/Ajax/url_source.ashx?get", { source_id:<%=id %>}, function (data) {
            wait.dismiss();
            if (data.code == 0) {
                var url = "";
                if (data.item.url != null)
                    url = data.item.url;        //粘贴的网址
                if (data.item.return_url != null)
                    url = data.item.return_url; //重定向后的网址
                //对重定向的网址做处理
                
                //微信链接处理
                if (url.indexOf("http://mp.weixin.qq.com") > -1) {
                    window.ifm = data.item.source;
                    $(".iframe-body").append("<iframe id = 'ifmUrl' src = 'javascript:parent.ifm'></iframe>");
                    ifmLoad2();
                }
            }
            else {
                toast.show(data.msg);
            }
        }, "json");
    }

    function ifmLoad2() {
    setTimeout(function () {
        //解决ios微信链接内容显示不全Bug
        
       var maxWidth=$(window).width();
        //$(".iframe-body").css("width", $(window).width() + "px");
        $("#ifmUrl").css("width", $(window).width() + "px");
        $("#ifmUrl").css("height", $(window).height() + "px");
        
        //if ($("#ifmUrl").attr("src").indexOf("http") != 0 && navigator.userAgent.toLowerCase().indexOf("iphone os") != -1) {
            //$("#ifmUrl").contents().find("body").css("width", $(window).width() + "px");
        //}
       alert(maxWidth);
       
        $("#ifmUrl").contents().find("[data-src]").each(function () {
            $(this).attr("src", $(this).attr("data-src"));
            if($(this).width()>maxWidth)
                $(this).css("width",maxWidth+"px");
        });
  
    }, 500);
}
    load();
</script>
</body>
</html>
